import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by wangyg on 2016/11/2.
 */
public class JavaGeneric {
	//Log log = LogFactory.getLog(JavaGeneric.class);
	//Log log = LogFactory.getLog(this.getClass());
	public static void main(String[] args)
			throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
		List a = new ArrayList();
		List<String> b = new ArrayList<String>();
		a.add(1);
		a.add("hello");
		b.add("hello");
		//	b.add(123);

		Class<? extends List> aClass = a.getClass();
		Class<? extends List> bClass = b.getClass();
		System.out.println(aClass==bClass);

		Method m = bClass.getMethod("add",Object.class);
		m.invoke(b,22);
		System.out.println("集合的大小为："+b.size());
		System.out.println("集合的内容为:"+b);
	}

}
